/*
 * @Description:
 * @Author: Fu Fei
 * @Date: 2020-08-11 13:25:14
 * @LastEditTime: 2022-01-20 15:58:12
 * @LastEditors: yyq
 * @FilePath: \undefinedc:\Users\Yaopei\AppData\Local\Temp\fz3temp-2\mojs.js
 */

function copyRight () {
    var footlogo =
    '<span style="vertical-align: top;display: inline-block;">&nbsp;&nbsp;&nbsp;&nbsp;技术支持</span> <a id="flogo" target="_blank" href="http://www.uemo.net"><img src="http://resources.jsmo.xin/templates/upload/2/logo/logo.png" width="50" height="20"></a>';

    if (window.location.origin.indexOf("uemo.net") != -1 && !$("#flogo")[0]) {
        $(footlogo).appendTo("#footer>p");

        $("#assistBtn ._fa-qq").attr("href", "tel:010-69557550");

        $("#assistBtn ._fa-qq").attr(
            "href",
            "tencent://message/?uin=2852263145&Site=uemo&Menu=yes"
        );

        $("#contactinfo .contact_name").text("魔艺(UEmo)极速建站系统");

        $("#contactinfo .contact_add").text("地址：北京市建外SOHO东区2号楼");

        $("#contactinfo .contact_zip").text("邮编：100000");

        $("#contactinfo .contact_tel").text("电话：010-69557550");

        $("#contactinfo .contact_mob").text("手机：13121672111 / 13121889333");

        $("#contactinfo .contact_eml").text("邮箱：touch@uelike.com");

        $("#online_lx #olx_qq a")
            .attr("href", "tencent://message/?uin=2852263145&Site=uemo&Menu=yes")

            .text("2852263145");

        $("#online_lx #olx_tel p").text("010-69557550");

        var add =
            '<li class="navitem"> <a href="http://www.uemo.net/" target="_blank"> <span data-title="返回UEmo">返回UEmo</span> </a></li>';

        $(add).insertAfter($("#header .content .nav>.navitem:last"));

        $(add).insertAfter($("#navMini .content .nav>.navitem:last"));

        $("#copyright").remove();
    }

    if (window.location.origin.indexOf("jsmo.xin") != -1) {
        $('#flogo').prev().remove();
        $("#flogo,#flogodes").remove();
    }
    if (window.location.origin.indexOf("banmazan.com") != -1) {
        $('#flogo').prev().remove();
        $("#flogo,#flogodes").remove();
    }
}
function addEditorPagePlugin () {
    var hm = document.createElement('script');
    var protocol = window.location.protocol;
    hm.src = protocol + '//resources.jsmo.xin/templates/upload/editor_js/mo05/mojs.js';
    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(hm, s);
}
// 微信分享
function isWeiXin() {
  var ua = window.navigator.userAgent.toLowerCase();
  if (ua.match(/MicroMessenger/i) == 'micromessenger') {
    return true;
  } else {
    return false;
  }
}
function weixinHandle() {
    if (!isWeiXin()) return;
    var hm = document.createElement('script');
  
    hm.src = '//res2.wx.qq.com/open/js/jweixin-1.4.0.js';
  
    var s = document.getElementsByTagName('script')[0];
  
    s.parentNode.insertBefore(hm, s);
    hm.id = 'weixin_share';
    hm.addEventListener('load', function () {
      $.post(
        window.location.origin,
        {
          no_cache: 1,
          get_jsapi_config: 1,
          url: window.location.href
        },
        res => {
          try {
            var config = JSON.parse(res);
            wx.config(config);
            wx.ready(function () {
              var shareData = {
                title: document.title,
                link: document.location.href,
                imgUrl: /^https?/.test($('.mm-hlogo img').attr('src'))
                  ? $('.mm-hlogo img').attr('src')
                  : 'http:' + $('.mm-hlogo img').attr('src'),
                desc: $("meta[name='description']").attr('content'),
                success: function () {}
              };
              wx.onMenuShareTimeline(shareData);
              wx.onMenuShareTimeline(shareData);
              wx.onMenuShareAppMessage(shareData);
              wx.onMenuShareQQ(shareData);
              wx.onMenuShareWeibo(shareData);
              wx.onMenuShareQZone(shareData);
            });
          } catch (error) {
            console.log('error', error);
          }
        }
      );
    });
}

function onlinePos() {
  if($('#online')[0]) {
    var _bottom = $('#footer').outerHeight();
    $('#online').css({
      bottom: _bottom
    });
  }
}

$(function () {
    copyRight()
    addEditorPagePlugin();
    weixinHandle();
    onlinePos();

    window.isMiniApp = window.__wxjs_environment;
})